<template>
  <el-dialog v-model="model" :title="title" width="30%">
    <FormRenderer
      class="form-container"
      labelWidth="120px"
      labelPosition="top"
      :modelValue="formData"
      @update:modelValue="$emit('update:formData', $event)"
      :schema="formSchema"
    />
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="model = false">关闭</el-button>
        <el-button type="primary">确定</el-button>
      </span>
    </template>
  </el-dialog>
</template>
<script setup lang="ts">
  import FormRenderer from "@/components/FormRenderer.vue";

  const model = defineModel();
  defineEmits<{
    "update:formData": [value: Record<string, any>];
  }>();
  interface Props {
    title: string;
    formSchema: any[];
    formData: Record<string, any>;
  }

  defineProps<Props>();
</script>

<style scoped lang="scss"></style>
